#pragma once
#include "../include/football/FootBallMatch.h"
#include "OwerTeam.h"
enum STATEMATCH{ ATTACKSTATE, DEFENCESTATE, INDENTIFYSTATE };

class AITeamState
{
private:	
	OwerTeam* aiTeam;
	static AITeamState* instance;
public:
	static AITeamState* GetInstance();
	static void FreeInstance();

	AITeamState(void);
	~AITeamState(void);
	std::vector<Player*> GetOpntTeam();

	int closestPeople;
	int sign;
	int currentSide;
	double timeCompleteAction;
	double countTime;
	bool checkTime;
	STATEMATCH state;
	Player* Closet_Player; 
	Player* Opnt_Closet_Player;
	FootBallMatch* footBallMatch;

	vector<Player*> team;
	vector<Player*> opnt_team;

	void Init(FootBallMatch* _football);
	void Update(FootBallMatch* _football);

	void Calc_Distant2Ball(FootBallMatch* _this);
	Player* FindRecivePlayer(std::vector<Player*>,std::vector<Player*>);
	bool Is_Control_Ball();
	bool trong_vong_cam(FootBallMatch* _this);

	STATEMATCH GetState();

	vector2d areaActivite[MAX_PLAYER_TYPE];
	void InitAreaActivite();
	PLAYERTYPE GetAreaOfBall();
	void CalAreaOfBall();

	void ResetTimeCount(double maxTime);
	PLAYERTYPE areaOfBall;
};
